package com.qidianit.mes.device.service.impl;

import com.github.pagehelper.PageHelper;
import com.qidianit.common.pojo.MESResult;
import com.qidianit.common.util.Constant;
import com.qidianit.mes.device.mapper.DeviceMaintainItemMapper;
import com.qidianit.mes.device.service.DeviceMaintainItemService;
import com.qidianit.mes.pojo.DeviceMaintainItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Console;
import java.util.List;

@Service
public class DeviceMaintainItemServiceImpl implements DeviceMaintainItemService {

    @Autowired
    DeviceMaintainItemMapper deviceMaintainItemMapper;
    @Override
    public MESResult list(String projectCode, String projectName, String projectType,Integer page,Integer limit) {
        PageHelper.startPage(page,limit);
        List<DeviceMaintainItem> deviceMaintainItems = deviceMaintainItemMapper.list(projectCode,projectName,projectType);
        return MESResult.success(deviceMaintainItems);
    }

    @Override
    public MESResult add(DeviceMaintainItem deviceMaintainItem) {
        deviceMaintainItem.setProjectStatus("1");
        deviceMaintainItemMapper.add(deviceMaintainItem);
        return MESResult.success(Constant.RESPONSE_STATUS_OK);
    }

    @Override
    public MESResult edit(DeviceMaintainItem deviceMaintainItem) {
        deviceMaintainItemMapper.edit(deviceMaintainItem);
        return MESResult.success(Constant.RESPONSE_STATUS_OK);
    }

    @Override
    public MESResult delete(String id) {
        return null;
    }
}
